home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d1
/
clipasc.arc
/
ASCSCAN.MAC
next >
Wrap
Text File
|
1987-03-17
|
3KB
|
188 lines
;----------------------------------------------------------------
; ASCSCAN - Header file for CLIPASC
; Description:
; ASCSCAN performs all macro definitions and general
; equates for CLIPASC
;----------------------------------------------------------------
extrn _parinfo:far
extrn _parc:far
extrn _parni:far
extrn _parnl:far
extrn _pards:far
extrn _parl:far
extrn _retc:far
extrn _retni:far
extrn _retnl:far
extrn _retds:far
extrn _retl:far
;------ Equates for type
undef equ 0
character equ 1
numeric equ 2
logical equ 4
date equ 8
optional equ 8000h ; additional flag for parm type
;------ get number of parms passed--returned in AX
get_pcount macro
xor ax,ax
push ax
call _parinfo
add sp,2
endm
;------ get type of requested parm--returned in AX
get_ptype macro n
mov ax,n
push ax
call _parinfo
add sp,2
endm
;------ get requested parm as string--returns segment and offset in AX:BX
get_char macro n
mov ax,n
push ax
call _parc
add sp,2
endm
;------ get requested parm as integer--returned in AX
get_int macro n
mov ax,n
push ax
call _parni
add sp,2
endm
;------ get requested parm as long integer--returned in AX:BX
get_long macro n
mov ax,n
push ax
call _parnl
add sp,2
endm
;------ get requested parm as date string--returns segment and offset as AX:BX
get_datestr macro n
mov ax,n
push ax
call _pards
add sp,2
endm
;------ get requested parm as logical true or false--returned in AX
get_logical macro n
mov ax,n
push ax
call _parl
add sp,2
endm
;------ return char pointer in REG1:REG2
ret_char macro reg1,reg2
irp x,<reg1,reg2>
push x
endm
call _retc
add sp,4
endm
;------ return integer in REG1
ret_int macro reg1
push reg1
call _retni
add sp,2
endm
;------ return long integer in REG1:REG2
ret_long macro reg1,reg2
irp x,<reg1,reg2>
push x
endm
call _retnl
add sp,4
endm
;------ return date string pointed to by REG1:REG2
ret_datestr macro reg1,reg2 ; return pointer to date string
; in reg1:reg2
irp x,<reg1,reg2>
push x
endm
call _retds
add sp,4
endm
;------ return logical true (1) or false (0) in REG1
ret_logical macro reg1 ; return 1 or 0 in reg1
push reg1
call _retl
add sp,2
endm
;------ End of Clipper dependent macros
parm_chk macro scan_loc,ret_addr
local chk_1,chk_fail,chk_2
mov cx,&scan_loc ; get max number of parms
get_pcount
mov si,offset &scan_loc + 2 ; want second word at loc
cmp ax,cx ; greater than max number?
jle chk_1
mov ax,err_inv_parms ; return code
jmp &ret_addr
chk_1:
push cx ; save which parm we're on
push si
mov ax,&scan_loc
sub ax,cx
inc ax ; get parm number to check
push ax
call _parinfo ; well, what is it?
pop dx ; save stored AX
pop si
mov bx,ax ; what we got back
lodsw ; get what it should be
cmp al,bl ; did we get what we wanted. Only check
; the low byte. High byte are flags
je chk_2 ; yes, don't worry about it
test ax,optional ; could they skip it?
jz chk_fail
cmp bx,undef ; did they skip it?
je chk_2 ; oh, that's cool, then.
chk_fail:
mov ax,dx
pop cx ; throw away saved CX
add ax,err_parms_base
jmp &ret_addr
chk_2:
pop cx ; restore number left to check
loop chk_1 ; and try it again
endm